$execute unless data entity @s Inventory[{Slot:8b}].components."minecraft:custom_data".bag[$(select_arrow)] run return fail

#item
$execute anchored eyes positioned ^ ^ ^ run summon item ~ ~-0.22 ~ {Item:{id:"arrow"},Tags:[init],PickupDelay:40s,Motion:$(drop_arrow)}
$data modify storage dab:system temp.bag set from entity @s Inventory[{Slot:8b}].components."minecraft:custom_data".bag[$(select_arrow)]
execute anchored eyes positioned ^ ^ ^ positioned ~ ~-0.22 ~ as @n[tag=init,distance=..3,type=item] at @s run function dab:system/arrow_bundle/storage/drop_arrow/item_data

#bundle
summon armor_stand ~ ~ ~ {Tags:[temp],Invisible:1b,Invulnerable:1b,Marker:1b,Small:1b}

item replace entity @n[tag=temp,distance=..1,type=armor_stand] weapon.mainhand from entity @s hotbar.8

data remove entity @n[tag=temp,distance=..1,type=armor_stand] HandItems[0].components."minecraft:custom_data".drop_arrow

item replace entity @s hotbar.8 from entity @n[tag=temp,distance=..1,type=armor_stand] weapon.mainhand

kill @n[tag=temp,distance=..1,type=armor_stand]
tag @n[tag=tempItem,distance=..1,type=item] remove tempItem

$function dab:system/arrow_bundle/storage/arrow_count/remove {value:1,index:$(select_arrow)}

playsound item.bundle.drop_contents player @a ~ ~ ~ 1.0 1.0